#ifndef _PLAYER_H
#define _PLAYER_H

#include <allegro.h>
#include "globals.h"
#include "data.h"
#include "map.h"
#include "enemy.h"

#define MAX_PLAYER                      4
#define SHOOT_STRAIGHT                  0
#define SHOOT_UP                        1
#define SHOOT_UP_CORNER_LEFT            2
#define SHOOT_UP_CORNER_RIGHT           3
#define SHOOT_DOWN                      4
#define SHOOT_DOWN_CORNER_LEFT          5
#define SHOOT_DOWN_CORNER_RIGHT         6

//Structs for the player(s)

struct player{
    int id;
    float cur_x,cur_y;                    //x and y position of sprite
    float x1,y1;                          //bounding box
    float x2,y2;                          //bounding box
    int spr;                            //Current sprite
    int dead;                           //Is dead?
    int dir;                            //Which direction facing
    int mov;                            //movement counter
    int wait;                           //non-movement counter
    int shoot;                          //Shooting
    int shoot_dir;                      //Shooting Direction
    int shoot_count;                    //Shooting Counter
    int lives;                          //Amount of lives
    float energy;                         //Amount of energy
    int hit;                            //Player hit?
    int points;                         //Points per session
}local[MAX_PLAYER];

struct shot{
    int id;
    float cur_x,cur_y;
    float x1,x2;
    float y1,y2;
    int spr;
    int alive;
    int dir;
    int dir_face;
}local_shot[MAX_PLAYER];    

DATAFILE *player_sprites;                       //Data file for player sprites

//Prototypes
void init_player(int amount);
void player_control(int amount);
void draw_player(int amount);
void player_death(int id);
void player_shoot(int id);
void update_player_shot(int amount,int enemy_count);
void kill_player_shot(int id);
void draw_player_shot(int amount);
void player_logic(void);
//player related collisions
int tile_col_player(struct TILE t,struct player p);                 //Collision detection
int tile_col_shot(struct TILE t,struct  shot s);
int enemy_col_player(struct enemy t,struct player p);
int enemy_shot_col_player(struct enemy_shot s,struct player p);
int enemy_col_player_shot(struct enemy e,struct shot s);
int enemy_shot_col_player_shot(struct enemy_shot e,struct shot s);

#endif
